home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 9866 / 9866.xpi / modules / rss / 205.jsm < prev    next >
Encoding:
Text File  |  2009-09-25  |  2.0 KB  |  56 lines

  1. Components.utils.import("resource://samfind/rss/samfind_modrssutils.jsm");
  2.  
  3. var EXPORTED_SYMBOLS = ["samfindRSSGetLink", "samfindRSSGetTitle", "samfindRSSGetDate", "samfindRSSGetImage", "samfindRSSGetContent"];
  4.  
  5. function samfindRSSGetLink(websiteRssUrl, item)
  6. {
  7.     return null;    
  8. }
  9.  
  10. function samfindRSSGetTitle(websiteRssUrl, item)
  11. {
  12.     return null;    
  13. }
  14.  
  15. function samfindRSSGetDate(websiteRssUrl, item)
  16. {
  17.     return null;
  18. }
  19.  
  20. function samfindRSSGetImage(websiteRssUrl, item)
  21. {
  22.     return null;
  23. }
  24.  
  25. function samfindRSSGetContent(websiteRssUrl, item, title, link)
  26. {
  27.     var content = (item.getElementsByTagName("description"))[0];
  28.     if (!content)
  29.     {
  30.         return null;
  31.     }
  32.     var response = content.textContent;
  33.     response = response.replace(/&(lt|gt);/g, function(strMatch, p1){return (p1 == "lt") ? "<" : ">";});
  34.     response = response.replace(/<\/?[^>]+(>|$)/g, " ");
  35.     response = samfind_modrssutils.HTML2Text(response);
  36.     response += '<table cellpadding="0" cellspacing="0"><tr>';
  37.     var diggs = (item.getElementsByTagNameNS("http://digg.com/docs/diggrss/", "diggCount"))[0];
  38.     if (diggs)
  39.     {
  40.         response += '<td class="diggs" valign="center"><a href="' + link + '">' + diggs.textContent + '</a></td>';
  41.     }
  42.     var comments = (item.getElementsByTagNameNS("http://digg.com/docs/diggrss/", "commentCount"))[0];
  43.     if (comments)
  44.     {
  45.         response += '<td class="comments" valign="center"><a href="' + link + '">' + comments.textContent + ' comments</a></td>';
  46.     }
  47.     var submitter = (item.getElementsByTagNameNS("http://digg.com/docs/diggrss/", "username"))[0];
  48.     if (submitter)
  49.     {
  50.         submitter = submitter.textContent;
  51.         response += '<td valign="center"><a href="http://digg.com/users/' + submitter + '"><img src="http://digg.com/users/' + submitter + '/l.png" width="24" height="24" border="0"/></a></td>';
  52.         response += '<td class="submitter" valign="center"><a href="http://digg.com/users/' + submitter + '">' + submitter + '</a></td>';
  53.     }
  54.     response += '</tr></table>';
  55.     return response;
  56. }